<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<script>
	$(function(){
		/*
		请求服务器 根据返回的json解析 json字符串
		*/
		$.ajax({
			type:"GET",
			url:"<c:url value='/AServlet'/>",
			dataType:"json",
			success:function(msg){
				/*
				这个时候是就不需要eval 因为返回的就是json数据 直径调用就行了
				*/
				var name = msg.name;
				var age = msg.age;
				var sex = msg.male;
				$("#h1").text(name+", "+age+", "+sex);
			}
		
		
		});
		
	
	
	
	});

</script>
<title>Insert title here</title>
</head>
<body>
<h1>客户端解析 json</h1>
<h1 id="h1"></h1>
</body>
</html>